<template>
  <div class="user-container">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>用户列表</span>
          <el-button type="primary" @click="handleAdd">新增用户</el-button>
        </div>
      </template>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="id" label="ID" width="80" />
        <el-table-column prop="username" label="用户名" />
        <el-table-column prop="role" label="角色" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column label="操作" width="200">
          <template #default="scope">
            <el-button type="primary" link @click="handleEdit(scope.row)">编辑</el-button>
            <el-button type="danger" link @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script setup>
const tableData = [
  {
    id: 1,
    username: 'admin',
    role: '管理员',
    createTime: '2024-01-01 12:00:00'
  },
  {
    id: 2,
    username: 'user',
    role: '普通用户',
    createTime: '2024-01-02 12:00:00'
  }
]

const handleAdd = () => {
  // 实现新增用户逻辑
}

const handleEdit = (row) => {
  // 实现编辑用户逻辑
}

const handleDelete = (row) => {
  // 实现删除用户逻辑
}
</script>

<style lang="scss" scoped>
.user-container {
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}
</style> 